home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-06-15 | 1.6 KB | 49 lines | [TEXT/ToyS] |
- -- This is a very useful function that returns the name of a file,
- -- given its full path name
- -- Feel free to use it in your own scripts!
-
- on FindName(fullPathName)
- if {string} does not contain class of fullPathName then
- set fullPathName to (fullPathName as string)
- end if
- try
- set oldDelimiters to (AppleScript's text item delimiters)
- set AppleScript's text item delimiters to {":"}
- set theName to (last text item of fullPathName)
- set AppleScript's text item delimiters to oldDelimiters
- on error
- set AppleScript's text item delimiters to oldDelimiters
- end try
- return theName
- end FindName
-
- on open fileList -- This is necessary for drop-ability
-
- -- First thing: find my name: it's the receiver's name
- set whoToSendTo to (FindName(path to me))
-
- tell application "Eudora1.4.2"
- repeat with oneFile in fileList
- -- I prefer to create a new mail message for each document because some mailers cannot
- -- cope with multiple attachements (e.g. non-MIME-aware mailers)
- set newMsg to make objectclass message inserthere end of mailbox "Out" of mail folder ""
- set field "To:" of newMsg to whoToSendTo
-
- -- Find the name of the file; the "my" is necessary for Eudora not to interpret the
- -- FindName procedure...
- set oneFileName to my (FindName(oneFile))
- set field "Subject:" of newMsg to oneFileName
-
- attach newMsg documentlist oneFile
- queue newMsg queuetype 1
-
- end repeat
-
- with timeout of 3600 seconds -- 1 hour ought to do it!
- connect with send and when idle without check -- Send the queued messages
- end timeout
-
- end tell
- end open
-
-